{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4c5092b2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.662598Z",
     "start_time": "2024-06-29T12:25:44.303691Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9ac9c699",
   "metadata": {},
   "source": [
    "# 数据读取"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24035db7",
   "metadata": {},
   "source": [
    "## 车辆信息表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "69b643d9",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.678720Z",
     "start_time": "2024-06-29T12:25:44.664047Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "clxx = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_CLXX.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1776fb85",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.693782Z",
     "start_time": "2024-06-29T12:25:44.680794Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>cph</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1827</td>\n",
       "      <td>\\t鄂AJC558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1802</td>\n",
       "      <td>鄂AKX820</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1803</td>\n",
       "      <td>鄂AKX820</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1755</td>\n",
       "      <td>鄂AUL326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1877</td>\n",
       "      <td>卾AEU730</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     id        cph\n",
       "0  1827  \\t鄂AJC558\n",
       "1  1802    鄂AKX820\n",
       "2  1803    鄂AKX820\n",
       "3  1755    鄂AUL326\n",
       "4  1877    卾AEU730"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "clxx.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e933cfe5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.709649Z",
     "start_time": "2024-06-29T12:25:44.695599Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1937, 2)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clxx.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4eda2a0d",
   "metadata": {},
   "source": [
    "## 发货地信息表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "145f026a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.725394Z",
     "start_time": "2024-06-29T12:25:44.711103Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "fhdxx = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_FHDXX.csv', encoding='utf-8')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "ad59244c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.741314Z",
     "start_time": "2024-06-29T12:25:44.727159Z"
    }
   },
   "outputs": [],
   "source": [
    "fhdxx=fhdxx[['id','mc']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "653c6ac8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.757205Z",
     "start_time": "2024-06-29T12:25:44.743109Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>mc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1212</td>\n",
       "      <td>军山码头</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>128</td>\n",
       "      <td>江北码头</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>123</td>\n",
       "      <td>船厂码头</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>121</td>\n",
       "      <td>江南码头</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>124</td>\n",
       "      <td>德旺码头</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     id    mc\n",
       "0  1212  军山码头\n",
       "1   128  江北码头\n",
       "2   123  船厂码头\n",
       "3   121  江南码头\n",
       "4   124  德旺码头"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "fhdxx.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "46233fa9",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.772427Z",
     "start_time": "2024-06-29T12:25:44.758417Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(34, 2)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fhdxx.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4dbc0328",
   "metadata": {},
   "source": [
    "## 发货记录表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0b82a5a2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.866571Z",
     "start_time": "2024-06-29T12:25:44.774430Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "fhjl = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_FHJL.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4c1c8e38",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.882579Z",
     "start_time": "2024-06-29T12:25:44.870483Z"
    }
   },
   "outputs": [],
   "source": [
    "fhjl=fhjl[['id','khxx_id','zdxx_id','khxd_id','fhdxx_id','jz','dzdw','dj','hk','clxx_id','create_time']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "dfe09e65",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.897272Z",
     "start_time": "2024-06-29T12:25:44.882911Z"
    }
   },
   "outputs": [],
   "source": [
    "fhjl.columns=['fhjl_id','khxx_id','zdxx_id','khxd_id','fhdxx_id','jz','dzdw','dj','hk','clxx_id','create_time']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "dbbd61a1",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.927972Z",
     "start_time": "2024-06-29T12:25:44.898476Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fhjl_id</th>\n",
       "      <th>khxx_id</th>\n",
       "      <th>zdxx_id</th>\n",
       "      <th>khxd_id</th>\n",
       "      <th>fhdxx_id</th>\n",
       "      <th>jz</th>\n",
       "      <th>dzdw</th>\n",
       "      <th>dj</th>\n",
       "      <th>hk</th>\n",
       "      <th>clxx_id</th>\n",
       "      <th>create_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>158</th>\n",
       "      <td>2700</td>\n",
       "      <td>86</td>\n",
       "      <td>156</td>\n",
       "      <td>2244</td>\n",
       "      <td>104</td>\n",
       "      <td>38.18</td>\n",
       "      <td>38.18</td>\n",
       "      <td>225.0</td>\n",
       "      <td>8590.50</td>\n",
       "      <td>176</td>\n",
       "      <td>2022-07-26 02:12:51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268</th>\n",
       "      <td>2825</td>\n",
       "      <td>117</td>\n",
       "      <td>97</td>\n",
       "      <td>2412</td>\n",
       "      <td>103</td>\n",
       "      <td>32.80</td>\n",
       "      <td>32.72</td>\n",
       "      <td>253.0</td>\n",
       "      <td>8298.40</td>\n",
       "      <td>258</td>\n",
       "      <td>2022-07-28 13:26:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>761</th>\n",
       "      <td>4759</td>\n",
       "      <td>74</td>\n",
       "      <td>52</td>\n",
       "      <td>2022</td>\n",
       "      <td>124</td>\n",
       "      <td>46.74</td>\n",
       "      <td>46.89</td>\n",
       "      <td>322.0</td>\n",
       "      <td>15050.28</td>\n",
       "      <td>76</td>\n",
       "      <td>2022-07-23 08:19:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>762</th>\n",
       "      <td>4760</td>\n",
       "      <td>74</td>\n",
       "      <td>52</td>\n",
       "      <td>2022</td>\n",
       "      <td>124</td>\n",
       "      <td>50.57</td>\n",
       "      <td>50.52</td>\n",
       "      <td>322.0</td>\n",
       "      <td>16283.54</td>\n",
       "      <td>79</td>\n",
       "      <td>2022-07-23 08:19:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>763</th>\n",
       "      <td>4761</td>\n",
       "      <td>111</td>\n",
       "      <td>224</td>\n",
       "      <td>2028</td>\n",
       "      <td>105</td>\n",
       "      <td>40.24</td>\n",
       "      <td>40.10</td>\n",
       "      <td>250.0</td>\n",
       "      <td>10060.00</td>\n",
       "      <td>125</td>\n",
       "      <td>2022-07-27 08:48:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49861</th>\n",
       "      <td>60700</td>\n",
       "      <td>483</td>\n",
       "      <td>1206</td>\n",
       "      <td>32885</td>\n",
       "      <td>104</td>\n",
       "      <td>33.08</td>\n",
       "      <td>32.85</td>\n",
       "      <td>160.0</td>\n",
       "      <td>5292.80</td>\n",
       "      <td>109</td>\n",
       "      <td>2024-06-24 08:45:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49862</th>\n",
       "      <td>60701</td>\n",
       "      <td>640</td>\n",
       "      <td>1218</td>\n",
       "      <td>32884</td>\n",
       "      <td>104</td>\n",
       "      <td>40.55</td>\n",
       "      <td>40.62</td>\n",
       "      <td>175.0</td>\n",
       "      <td>7096.25</td>\n",
       "      <td>120</td>\n",
       "      <td>2024-06-24 09:24:16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49863</th>\n",
       "      <td>60702</td>\n",
       "      <td>483</td>\n",
       "      <td>1206</td>\n",
       "      <td>32885</td>\n",
       "      <td>104</td>\n",
       "      <td>32.45</td>\n",
       "      <td>32.44</td>\n",
       "      <td>160.0</td>\n",
       "      <td>5192.00</td>\n",
       "      <td>116</td>\n",
       "      <td>2024-06-24 10:30:13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49864</th>\n",
       "      <td>60703</td>\n",
       "      <td>546</td>\n",
       "      <td>979</td>\n",
       "      <td>32882</td>\n",
       "      <td>104</td>\n",
       "      <td>41.55</td>\n",
       "      <td>41.55</td>\n",
       "      <td>175.0</td>\n",
       "      <td>7271.25</td>\n",
       "      <td>121</td>\n",
       "      <td>2024-06-24 10:58:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49865</th>\n",
       "      <td>60704</td>\n",
       "      <td>342</td>\n",
       "      <td>458</td>\n",
       "      <td>32892</td>\n",
       "      <td>104</td>\n",
       "      <td>40.70</td>\n",
       "      <td>40.60</td>\n",
       "      <td>165.0</td>\n",
       "      <td>6715.50</td>\n",
       "      <td>124</td>\n",
       "      <td>2024-06-24 11:24:45</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>21327 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       fhjl_id  khxx_id  zdxx_id  khxd_id  fhdxx_id     jz   dzdw     dj  \\\n",
       "158       2700       86      156     2244       104  38.18  38.18  225.0   \n",
       "268       2825      117       97     2412       103  32.80  32.72  253.0   \n",
       "761       4759       74       52     2022       124  46.74  46.89  322.0   \n",
       "762       4760       74       52     2022       124  50.57  50.52  322.0   \n",
       "763       4761      111      224     2028       105  40.24  40.10  250.0   \n",
       "...        ...      ...      ...      ...       ...    ...    ...    ...   \n",
       "49861    60700      483     1206    32885       104  33.08  32.85  160.0   \n",
       "49862    60701      640     1218    32884       104  40.55  40.62  175.0   \n",
       "49863    60702      483     1206    32885       104  32.45  32.44  160.0   \n",
       "49864    60703      546      979    32882       104  41.55  41.55  175.0   \n",
       "49865    60704      342      458    32892       104  40.70  40.60  165.0   \n",
       "\n",
       "             hk  clxx_id          create_time  \n",
       "158     8590.50      176  2022-07-26 02:12:51  \n",
       "268     8298.40      258  2022-07-28 13:26:58  \n",
       "761    15050.28       76  2022-07-23 08:19:58  \n",
       "762    16283.54       79  2022-07-23 08:19:58  \n",
       "763    10060.00      125  2022-07-27 08:48:41  \n",
       "...         ...      ...                  ...  \n",
       "49861   5292.80      109  2024-06-24 08:45:57  \n",
       "49862   7096.25      120  2024-06-24 09:24:16  \n",
       "49863   5192.00      116  2024-06-24 10:30:13  \n",
       "49864   7271.25      121  2024-06-24 10:58:57  \n",
       "49865   6715.50      124  2024-06-24 11:24:45  \n",
       "\n",
       "[21327 rows x 11 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 指定你想要筛选的列名列表  \n",
    "columns_check = ['jz', 'dzdw', 'dj','hk']  \n",
    "  \n",
    "# 使用布尔索引筛选出这些列中没有任何一列小于或等于0的所有行  \n",
    "fhjl = fhjl[~(fhjl[columns_check] <= 0).any(axis=1)]  \n",
    "\n",
    "# 删除这四列中存在缺失值的行  \n",
    "fhjl = fhjl.dropna(subset=['jz', 'dzdw', 'dj','hk'])  \n",
    "fhjl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5288c98c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.943417Z",
     "start_time": "2024-06-29T12:25:44.929389Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fhjl_id</th>\n",
       "      <th>khxx_id</th>\n",
       "      <th>zdxx_id</th>\n",
       "      <th>khxd_id</th>\n",
       "      <th>fhdxx_id</th>\n",
       "      <th>jz</th>\n",
       "      <th>dzdw</th>\n",
       "      <th>dj</th>\n",
       "      <th>hk</th>\n",
       "      <th>clxx_id</th>\n",
       "      <th>create_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>158</th>\n",
       "      <td>2700</td>\n",
       "      <td>86</td>\n",
       "      <td>156</td>\n",
       "      <td>2244</td>\n",
       "      <td>104</td>\n",
       "      <td>38.18</td>\n",
       "      <td>38.18</td>\n",
       "      <td>225.0</td>\n",
       "      <td>8590.50</td>\n",
       "      <td>176</td>\n",
       "      <td>2022-07-26 02:12:51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268</th>\n",
       "      <td>2825</td>\n",
       "      <td>117</td>\n",
       "      <td>97</td>\n",
       "      <td>2412</td>\n",
       "      <td>103</td>\n",
       "      <td>32.80</td>\n",
       "      <td>32.72</td>\n",
       "      <td>253.0</td>\n",
       "      <td>8298.40</td>\n",
       "      <td>258</td>\n",
       "      <td>2022-07-28 13:26:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>761</th>\n",
       "      <td>4759</td>\n",
       "      <td>74</td>\n",
       "      <td>52</td>\n",
       "      <td>2022</td>\n",
       "      <td>124</td>\n",
       "      <td>46.74</td>\n",
       "      <td>46.89</td>\n",
       "      <td>322.0</td>\n",
       "      <td>15050.28</td>\n",
       "      <td>76</td>\n",
       "      <td>2022-07-23 08:19:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>762</th>\n",
       "      <td>4760</td>\n",
       "      <td>74</td>\n",
       "      <td>52</td>\n",
       "      <td>2022</td>\n",
       "      <td>124</td>\n",
       "      <td>50.57</td>\n",
       "      <td>50.52</td>\n",
       "      <td>322.0</td>\n",
       "      <td>16283.54</td>\n",
       "      <td>79</td>\n",
       "      <td>2022-07-23 08:19:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>763</th>\n",
       "      <td>4761</td>\n",
       "      <td>111</td>\n",
       "      <td>224</td>\n",
       "      <td>2028</td>\n",
       "      <td>105</td>\n",
       "      <td>40.24</td>\n",
       "      <td>40.10</td>\n",
       "      <td>250.0</td>\n",
       "      <td>10060.00</td>\n",
       "      <td>125</td>\n",
       "      <td>2022-07-27 08:48:41</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     fhjl_id  khxx_id  zdxx_id  khxd_id  fhdxx_id     jz   dzdw     dj  \\\n",
       "158     2700       86      156     2244       104  38.18  38.18  225.0   \n",
       "268     2825      117       97     2412       103  32.80  32.72  253.0   \n",
       "761     4759       74       52     2022       124  46.74  46.89  322.0   \n",
       "762     4760       74       52     2022       124  50.57  50.52  322.0   \n",
       "763     4761      111      224     2028       105  40.24  40.10  250.0   \n",
       "\n",
       "           hk  clxx_id          create_time  \n",
       "158   8590.50      176  2022-07-26 02:12:51  \n",
       "268   8298.40      258  2022-07-28 13:26:58  \n",
       "761  15050.28       76  2022-07-23 08:19:58  \n",
       "762  16283.54       79  2022-07-23 08:19:58  \n",
       "763  10060.00      125  2022-07-27 08:48:41  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "fhjl.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "42b83662",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:44.959044Z",
     "start_time": "2024-06-29T12:25:44.945028Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(21327, 11)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fhjl.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c72464c",
   "metadata": {},
   "source": [
    "## 客户下单表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b77a4191",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.006404Z",
     "start_time": "2024-06-29T12:25:44.960300Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "khxd = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_KHXD.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "09d80b07",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.022383Z",
     "start_time": "2024-06-29T12:25:45.008128Z"
    }
   },
   "outputs": [],
   "source": [
    "khxd = khxd[['id','khxx_id','hplx', 'cpgg','cppp','fhdw','ywlx_code']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "48506ea4",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.038251Z",
     "start_time": "2024-06-29T12:25:45.024121Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>khxx_id</th>\n",
       "      <th>hplx</th>\n",
       "      <th>cpgg</th>\n",
       "      <th>cppp</th>\n",
       "      <th>fhdw</th>\n",
       "      <th>ywlx_code</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>79</td>\n",
       "      <td>37</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>745</td>\n",
       "      <td>141</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>865</td>\n",
       "      <td>141</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>928</td>\n",
       "      <td>141</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>958</td>\n",
       "      <td>141</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>配送 (贸易+起驳+运输)</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    id  khxx_id  hplx  cpgg  cppp   fhdw      ywlx_code\n",
       "0   79       37     0     0     0  100.0  配送 (贸易+起驳+运输)\n",
       "1  745      141     0     0     0  100.0  配送 (贸易+起驳+运输)\n",
       "2  865      141     0     0     0  200.0  配送 (贸易+起驳+运输)\n",
       "3  928      141     0     0     0  200.0  配送 (贸易+起驳+运输)\n",
       "4  958      141     0     0     0  150.0  配送 (贸易+起驳+运输)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "khxd.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "a530799c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.053760Z",
     "start_time": "2024-06-29T12:25:45.039707Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(27953, 7)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "khxd.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e3db66d",
   "metadata": {},
   "source": [
    "## 客户信息表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "8b7c981b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.069728Z",
     "start_time": "2024-06-29T12:25:45.055672Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "khxx = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_KHXX.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "48c28b03",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.085757Z",
     "start_time": "2024-06-29T12:25:45.071664Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>khmc</th>\n",
       "      <th>user_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>18</td>\n",
       "      <td>武汉中村</td>\n",
       "      <td>DS0403003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20</td>\n",
       "      <td>武汉昊恒(水泥)</td>\n",
       "      <td>DS0406000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>21</td>\n",
       "      <td>华安水泥(君善建)</td>\n",
       "      <td>DS0406000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>23</td>\n",
       "      <td>合力久盛(现金)</td>\n",
       "      <td>DS0404001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>24</td>\n",
       "      <td>达米安商贸</td>\n",
       "      <td>DS0404001</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id       khmc  user_name\n",
       "0  18       武汉中村  DS0403003\n",
       "1  20   武汉昊恒(水泥)  DS0406000\n",
       "2  21  华安水泥(君善建)  DS0406000\n",
       "3  23   合力久盛(现金)  DS0404001\n",
       "4  24      达米安商贸  DS0404001"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "khxx.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "69eeb0e8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.101697Z",
     "start_time": "2024-06-29T12:25:45.087670Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(535, 3)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "khxx.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d34b5d6b",
   "metadata": {},
   "source": [
    "## 站点信息表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "6182b645",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.117507Z",
     "start_time": "2024-06-29T12:25:45.103793Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "zdxx = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/ERP_ZDXX.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "b3b0cae3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.133398Z",
     "start_time": "2024-06-29T12:25:45.119350Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>khxx_id</th>\n",
       "      <th>zdmc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>26</td>\n",
       "      <td>20</td>\n",
       "      <td>武汉昊胜商砼</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>27</td>\n",
       "      <td>21</td>\n",
       "      <td>武汉君善建商砼</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>29</td>\n",
       "      <td>18</td>\n",
       "      <td>中村商砼</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>31</td>\n",
       "      <td>23</td>\n",
       "      <td>合力久盛长江新城商砼</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>32</td>\n",
       "      <td>23</td>\n",
       "      <td>合力久盛花山商砼</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id  khxx_id        zdmc\n",
       "0  26       20      武汉昊胜商砼\n",
       "1  27       21     武汉君善建商砼\n",
       "2  29       18        中村商砼\n",
       "3  31       23  合力久盛长江新城商砼\n",
       "4  32       23    合力久盛花山商砼"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "zdxx.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "7ce4d3d7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.148689Z",
     "start_time": "2024-06-29T12:25:45.134612Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1093, 3)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zdxx.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f576ce66",
   "metadata": {},
   "source": [
    "## 系统字典表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "fa79aa9c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.163971Z",
     "start_time": "2024-06-29T12:25:45.151867Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "xtzd = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/sys_dict_data.csv', encoding='utf-8')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e00ef236",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.179502Z",
     "start_time": "2024-06-29T12:25:45.169919Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>dict_type</th>\n",
       "      <th>dict_value</th>\n",
       "      <th>dict_label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>sys_user_sex</td>\n",
       "      <td>0</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>sys_user_sex</td>\n",
       "      <td>1</td>\n",
       "      <td>女</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>sys_user_sex</td>\n",
       "      <td>2</td>\n",
       "      <td>未知</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>sys_show_hide</td>\n",
       "      <td>0</td>\n",
       "      <td>显示</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>sys_show_hide</td>\n",
       "      <td>1</td>\n",
       "      <td>隐藏</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id      dict_type dict_value dict_label\n",
       "0   1   sys_user_sex          0          男\n",
       "1   2   sys_user_sex          1          女\n",
       "2   3   sys_user_sex          2         未知\n",
       "3   4  sys_show_hide          0         显示\n",
       "4   5  sys_show_hide          1         隐藏"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "xtzd.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "e4c6bc99",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.195258Z",
     "start_time": "2024-06-29T12:25:45.182152Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(266, 4)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xtzd.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b4ae1b2",
   "metadata": {},
   "source": [
    "## 系统用户表读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "fc0eb682",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.209976Z",
     "start_time": "2024-06-29T12:25:45.200008Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "xtyh = pd.read_csv('D:/24暑假实训/zuoye/thirteen/data/sys_user.csv', encoding='gb18030')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "a0ffdc41",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.225597Z",
     "start_time": "2024-06-29T12:25:45.211397Z"
    }
   },
   "outputs": [],
   "source": [
    "xtyh.columns=['uesr_id','user_name','sales_name']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "dd3ce629",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.241476Z",
     "start_time": "2024-06-29T12:25:45.227867Z"
    }
   },
   "outputs": [],
   "source": [
    "xtyh=xtyh[['user_name','sales_name']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "16fd7422",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.257113Z",
     "start_time": "2024-06-29T12:25:45.243098Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_name</th>\n",
       "      <th>sales_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>admin</td>\n",
       "      <td>系统管理员1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dsadmin</td>\n",
       "      <td>管理员</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>zhangsan</td>\n",
       "      <td>张三</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>testuser</td>\n",
       "      <td>testuser</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>xs01</td>\n",
       "      <td>销售一</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  user_name sales_name\n",
       "0     admin     系统管理员1\n",
       "1   dsadmin        管理员\n",
       "2  zhangsan         张三\n",
       "3  testuser   testuser\n",
       "4      xs01        销售一"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看数据的前五行（默认的）\n",
    "xtyh.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "0ad8685a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:45.272556Z",
     "start_time": "2024-06-29T12:25:45.258449Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(150, 2)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xtyh.shape  #查看数据集尺寸"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca9ed581",
   "metadata": {},
   "source": [
    "# 合并表数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "406b6c90",
   "metadata": {},
   "source": [
    "## 分别合并两张表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "6e0ee24c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:30.662200Z",
     "start_time": "2024-06-30T02:37:30.642420Z"
    }
   },
   "outputs": [],
   "source": [
    "ERP_df = pd.merge(fhjl, clxx, left_on='clxx_id', right_on='id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "7908e0ae",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:31.191712Z",
     "start_time": "2024-06-30T02:37:31.167931Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "ERP_df = pd.merge(ERP_df, fhdxx, left_on='fhdxx_id', right_on='id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ca99af18",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:31.613553Z",
     "start_time": "2024-06-30T02:37:31.589193Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "ERP_df = pd.merge(ERP_df, khxx, left_on='khxx_id', right_on='id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e0cf1e8d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:32.021673Z",
     "start_time": "2024-06-30T02:37:31.996162Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\hsuo\\AppData\\Local\\Temp\\ipykernel_12948\\1084638647.py:1: FutureWarning: Passing 'suffixes' which cause duplicate columns {'id_x'} in the result is deprecated and will raise a MergeError in a future version.\n",
      "  ERP_df = pd.merge(ERP_df, khxd, left_on='khxd_id', right_on='id', how='inner')\n"
     ]
    }
   ],
   "source": [
    "ERP_df = pd.merge(ERP_df, khxd, left_on='khxd_id', right_on='id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "4362ff61",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:32.473134Z",
     "start_time": "2024-06-30T02:37:32.426096Z"
    },
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "ERP_df = pd.merge(ERP_df, zdxx, left_on='zdxx_id', right_on='id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "bc3c4064",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:32.925807Z",
     "start_time": "2024-06-30T02:37:32.885800Z"
    }
   },
   "outputs": [],
   "source": [
    "ERP_df = pd.merge(ERP_df, xtyh, left_on='user_name', right_on='user_name', how='inner')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "53c456b8",
   "metadata": {},
   "source": [
    "## 提取需要的列数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "60b9d700",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:33.794914Z",
     "start_time": "2024-06-30T02:37:33.776760Z"
    }
   },
   "outputs": [],
   "source": [
    "ERP1_df=ERP_df[['fhjl_id','create_time','sales_name','ywlx_code','khmc','mc','zdmc','hplx','cpgg','cppp','fhdw','dzdw','dj','hk','cph']]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d9c4445a",
   "metadata": {},
   "source": [
    "# 保存表数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "dde36040",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:34.837588Z",
     "start_time": "2024-06-30T02:37:34.649593Z"
    }
   },
   "outputs": [],
   "source": [
    "# 保存合并后的CSV文件\n",
    "ERP1_df.to_csv('ERP1_file.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "afdb23fa",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-30T02:37:35.275147Z",
     "start_time": "2024-06-30T02:37:35.255503Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   fhjl_id          create_time sales_name   ywlx_code  khmc    mc    zdmc  \\\n",
      "0     2700  2022-07-26 02:12:51        李庭辉     自提 (贸易)  群祥鑫义  武新一期  孝昌立成商砼   \n",
      "1    40433  2023-08-12 21:47:01        李庭辉  配送 (贸易+运输)  群祥鑫义  武新一期  孝昌立成商砼   \n",
      "2    40856  2023-08-18 20:18:37        李庭辉  配送 (贸易+运输)  群祥鑫义  武新二期  孝昌立成商砼   \n",
      "3    41909  2023-08-29 04:54:56        李庭辉  配送 (贸易+运输)  群祥鑫义  武新二期  孝昌立成商砼   \n",
      "4    40212  2023-08-09 23:05:51        李庭辉  配送 (贸易+运输)  群祥鑫义  武新二期  孝昌立成商砼   \n",
      "\n",
      "   hplx  cpgg  cppp  fhdw   dzdw     dj      hk      cph  \n",
      "0     1     1     9  35.0  38.18  225.0  8590.5  鄂AUZ581  \n",
      "1     1     1     9  42.0  40.60  195.0  7944.3  鄂ATG603  \n",
      "2     1     1     9  42.0  39.70  195.0  7784.4  鄂AJX103  \n",
      "3     1     1     9  42.0  39.70  195.0  7768.8  鄂ADD000  \n",
      "4     1     1     9  42.0  37.30  195.0  7308.6  鄂APF730  \n"
     ]
    }
   ],
   "source": [
    "print(ERP1_df.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "b811fd37",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-06-29T12:25:52.061324Z",
     "start_time": "2024-06-29T12:25:52.050252Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(19942, 15)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ERP_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7edf1d9a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "435.312px",
    "left": "30px",
    "top": "198px",
    "width": "246.366px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
